package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.operate.ParkingRecordPageDTO;
import com.itlong.cloud.POJO.DTO.property.ParkPlaceProjectInfoDTO;
import com.itlong.cloud.POJO.VO.property.PropertyTemporaryCarFeeRecordVO;
import com.itlong.cloud.property.service.IPropertyParkingPassRecordService;
import com.itlong.cloud.user.property.IPropertyParkingPassRecordServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *      物业-智慧停车-停车场出入记录暴露接口实现类.
 * </desc>
 *
 * @createDate 2018/11/5
 */
@RestController
public class PropertyParkingPassRecordServiceResource implements IPropertyParkingPassRecordServiceClient {

    @Autowired
    IPropertyParkingPassRecordService iPropertyParkingPassRecordService;

    /**
     * <desc>
     *      停车场入场记录分页查询
     * <desc/>
     *
     * @param parkingRecordPageDTO 分页查询参数
     * @return 标准返回结果
     * @author Juguang.S
     * @createDate 2018/11/5
     */
    @Override
    @PostMapping(path = "/property/parking/getAdmissionRecordPage")
    public Page<PropertyTemporaryCarFeeRecordVO> getAdmissionRecordPage(@RequestBody ParkingRecordPageDTO parkingRecordPageDTO) throws Exception {
        return iPropertyParkingPassRecordService.getAdmissionRecordPage(parkingRecordPageDTO);
    }

    /**
     * <desc>
     *      停车场出场记录分页查询
     * <desc/>
     *
     * @param parkingRecordPageDTO 分页查询参数
     * @return 标准返回结果
     * @author Juguang.S
     * @createDate 2018/11/5
     */
    @Override
    @PostMapping(path = "/property/parking/getAppearanceRecordPage")
    public Page<PropertyTemporaryCarFeeRecordVO> getAppearanceRecordPage(@RequestBody ParkingRecordPageDTO parkingRecordPageDTO) throws Exception {
        return iPropertyParkingPassRecordService.getAppearanceRecordPage(parkingRecordPageDTO);
    }

    /**
     * <desc>
     *      获取当前开通了停车场的项目信息
     * </desc>
     *
     * @createDate 2018/11/08
     * @author Jiaqi.X
     */
    @Override
    @PostMapping(path = "/property/parking/getInStatusProjectIds")
    public List<ParkPlaceProjectInfoDTO> getInStatusProjectIds(){
        return iPropertyParkingPassRecordService.getInStatusProjectIds();
    }

    /**
     * <desc>
     *      获取项目下处于入场状态下的所有parkingId
     * </desc>
     *
     * @param projectId
     * @return
     * @createDate 2018/11/08
     * @author Jiaqi.X
     */
    @Override
    @PostMapping(path = "/property/parking/getInStatusParkingIdByProjectId")
    public List<String> getInStatusParkingIdByProjectId(@RequestParam("projectId") String projectId){
        return iPropertyParkingPassRecordService.getInStatusParkingIdByProjectId(projectId);
    }

    /**
     * <desc>
     *      获取项目下处于入场状态下的所有车牌号
     * </desc>
     *
     * @param projectId
     * @return
     * @createDate 2018/11/08
     * @author Jiaqi.X
     */
    @Override
    @PostMapping(path = "/property/parking/getInPlantNoByProjectId")
    public List<String> getInPlantNoByProjectId(@RequestParam("projectId") String projectId){
        return iPropertyParkingPassRecordService.getInPlantNoByProjectId(projectId);
    }

    /**
     * <desc>
     *      获取停车场key
     * </desc>
     *
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate  2018/11/08
     */
    @Override
    @PostMapping(path = "/property/parking/getParkingLotKey")
    public String getParkingLotKey(@RequestParam("projectId") String projectId) {
        return iPropertyParkingPassRecordService.getParkingLotKey(projectId);
    }
}